home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat 1994 November
/
macformat-018.iso
/
Utility Spectacular
/
Developer
/
Mac F2C 1.0
/
Mac F2C Libraries
/
libF77 Sources
/
pow_di.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS
UTF-8
Wrap
C/C++ Source or Header
|
1994-05-16
|
360 b
|
35 lines
|
[
TEXT/KAHL
]
#include "f2c.h"
#ifdef KR_headers
double pow_di(ap, bp) doublereal *ap; integer *bp;
#else
double pow_di(doublereal *ap, integer *bp)
#endif
{
double pow, x;
integer n;
pow = 1;
x = *ap;
n = *bp;
if(n != 0)
{
if(n < 0)
{
n = -n;
x = 1/x;
}
for( ; ; )
{
if(n & 01)
pow *= x;
if(n >>= 1)
x *= x;
else
break;
}
}
return(pow);
}